翻訳と辞書
Words near each other
・ Spikebuccinum
・ Spikebuccinum stephaniae
・ Spikebuck Town Mound and Village Site
・ Spiked
・ Spiked (magazine)
・ Spiked Atlantic spiny rat
・ Spiked crested coralroot
・ Spikedace
・ Spigelian fascia
・ Spigelian hernia
・ Spigit
・ Spigno
・ Spigno Monferrato
・ Spigno Saturnia
・ Spigot (disambiguation)
Spigot algorithm
・ Spigot Peak
・ Spihumonesty
・ Spijk
・ Spijk, Groningen
・ Spijk, Lingewaal
・ Spijk, Rijnwaarden
・ Spijkenisse
・ Spijkenisse Centrum (Rotterdam Metro)
・ Spijker V.1
・ Spijker V.2
・ Spijker V.3
・ Spijker's lemma
・ Spijkerboor
・ Spijkerboor, Drenthe


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Spigot algorithm : ウィキペディア英語版
Spigot algorithm
A spigot algorithm is an algorithm for computing the value of a mathematical constant such as or ''e'' which generates output digits left to right, with limited intermediate storage.
The name comes from a "spigot", meaning a tap or valve controlling the flow of a liquid.
Interest in such algorithms was spurred in the early days of computational mathematics by extreme constraints on memory, and an algorithm for calculating the digits of ''e'' appears in a paper by Sale in 1968. The name "Spigot algorithm" appears to have been coined by Stanley Rabinowitz and Stan Wagon,〔
〕 whose algorithm for calculating the digits of is sometimes referred to as "''the'' spigot algorithm for ".
The spigot algorithm of Rabinowitz and Wagon is ''bounded'', in the sense that the number of required digits must be specified in advance. Jeremy Gibbons (2004)
uses the term "''streaming algorithm''" to mean one which can be run indefinitely, without a prior bound. A further refinement is an algorithm which can compute a single arbitrary digit, without first computing the preceding digits: an example is the Bailey-Borwein-Plouffe formula, a digit extraction algorithm for which produces hexadecimal digits.
==Example==
This example illustrates the working of a spigot algorithm by calculating the binary digits of the natural logarithm of 2 using the identity
:\ln(2)=\sum_^\frac\, .
To start calculating binary digits from, say, the 8th place we multiply this identity by 27(since 7 = 8 - 1):
:2^7\ln(2) =2^7\sum_^\frac\, .
We then divide the infinite sum into a "head", in which the exponents of 2 are greater than or equal to zero, and a "tail", in which the exponents of 2 are negative:
:2^7\ln(2) =\sum_^\frac+\sum_^\frac \mod k}\, .
Calculating each of these terms and adding them to a running total where we again only keep the fractional part, we have:
:
We add a few terms in the "tail", noting that the error introduced by truncating the sum is less than the final term:
:
Adding the "head" and the first few terms of the "tail" together we get:
:2^7\ln(2)\mod \approx \frac+\frac=0.10011100 \cdots_ + 0.00011010 \cdots_ = 0.1011 \cdots_\, ,
so the 8th to 11th binary digits in the binary expansion of ln(2) are 1, 0, 1, 1. Note that we have not calculated the values of the first seven binary digits – indeed, all information about them has been intentionally discarded by using modular arithmetic in the "head" sum.
The same approach can be used to calculate digits of the binary expansion of ln(2) starting from an arbitrary ''n''th position. The number of terms in the "head" sum increases linearly with ''n'', but the complexity of each term only increases with the logarithm of ''n'' if an efficient method of modular exponentiation is used. The precision of calculations and intermediate results and the number of terms taken from the "tail" sum are all independent of ''n'', and only depend on the number of binary digits that are being calculated – single precision arithmetic can be used to calculate around 12 binary digits, regardless of the starting position.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Spigot algorithm」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.